package com.daimler.itffo.uvs.dialog;

import javax.swing.JDialog;
import javax.swing.JPanel;

import java.awt.Dialog;
import java.awt.Frame;
import java.awt.GridBagLayout;
import java.awt.Dimension;
import javax.swing.JLabel;
import java.awt.GridBagConstraints;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.KeyEvent;
import java.awt.Insets;
import javax.swing.JTextPane;


/**
 *
 * @author jfranken <br>
 * $Id: GfgView.java,v 1.2 2010/03/28 12:31:46 jboysen Exp $
 * @version 1.$Revision: 1.2 $
 */
public class GfgView extends JDialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2452378999140180660L;
	private JPanel _content_panel = null;
	private JLabel _table_label = null;
	private JLabel _source_file_label = null;
	private JComboBox _table_combo_box = null;
	private JTextField _source_file_text_field = null;
	private JButton _source_file_chooser_button = null;
	private JLabel _database_label = null;
	private JLabel _destination_folder_label = null;
	private JComboBox _database_combo_box = null;
	private JTextField _destination_folder_text_field = null;
	private JButton _destination_folder_chooser_button = null;
	private JButton _generate_button = null;
	private JTextPane _messages_pane = null;
	/**
	 * This method initializes
	 *
	 */
	public GfgView() {
		super((Frame)null,Dialog.ModalityType.TOOLKIT_MODAL);
		initialize();
	}

	/**
	 * This method initializes this
	 *
	 */
	private void initialize() {
        this.setSize(new Dimension(496, 283));
        this.setContentPane(get_content_panel());

	}

	/**
	 * This method initializes this
	 *
	 */
//	private void initialize() {
//	    this.setSize(new Dimension(496, 283));
//	    this.setContentPane(get_content_panel());
	
//	}

	/**
	 * This method initializes _content_panel
	 *
	 * @return javax.swing.JPanel
	 */
	private JPanel get_content_panel() {
		if (_content_panel==null) {
//			GridBagConstraints gridBagConstraints111 = new GridBagConstraints();
//			gridBagConstraints111.fill = GridBagConstraints.BOTH;
//			gridBagConstraints111.gridy = 5;
//			gridBagConstraints111.weightx = 1.0;
//			gridBagConstraints111.weighty = 1.0;
//			gridBagConstraints111.insets = new Insets(4, 4, 4, 4);
//			gridBagConstraints111.gridwidth = 3;
//			gridBagConstraints111.gridx = 0;
//			GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
//			gridBagConstraints10.gridx = 0;
//			gridBagConstraints10.gridwidth = 3;
//			gridBagConstraints10.gridy = 4;
//			GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
//			gridBagConstraints9.gridx = 2;
//			gridBagConstraints9.insets = new Insets(4, 4, 4, 4);
//			gridBagConstraints9.gridy = 3;
//			GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
//			gridBagConstraints8.fill = GridBagConstraints.VERTICAL;
//			gridBagConstraints8.gridy = 3;
//			gridBagConstraints8.weightx = 1.0;
//			gridBagConstraints8.insets = new Insets(4, 4, 4, 4);
//			gridBagConstraints8.gridx = 1;
//			GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
//			gridBagConstraints7.fill = GridBagConstraints.VERTICAL;
//			gridBagConstraints7.gridy = 3;
//			gridBagConstraints7.weightx = 1.0;
//			gridBagConstraints7.insets = new Insets(4, 4, 4, 4);
//			gridBagConstraints7.gridx = 0;
//			GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
//			gridBagConstraints6.gridx = 1;
//			gridBagConstraints6.gridy = 2;
//			_destination_folder_label = new JLabel();
//			_destination_folder_label.setText("Zielverzeichnis");
//			GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
//			gridBagConstraints5.gridx = 0;
//			gridBagConstraints5.gridy = 2;
//			_database_label = new JLabel();
//			_database_label.setText("Datenbank");
//			GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
//			gridBagConstraints4.gridx = 2;
//			gridBagConstraints4.gridy = 1;
//			GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
//			gridBagConstraints3.fill = GridBagConstraints.VERTICAL;
//			gridBagConstraints3.gridy = 1;
//			gridBagConstraints3.weightx = 1.0;
//			gridBagConstraints3.insets = new Insets(4, 4, 4, 4);
//			gridBagConstraints3.gridx = 1;
//			GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
//			gridBagConstraints11.fill = GridBagConstraints.VERTICAL;
//			gridBagConstraints11.gridy = 1;
//			gridBagConstraints11.weightx = 1.0;
//			gridBagConstraints11.insets = new Insets(4, 4, 4, 4);
//			gridBagConstraints11.gridx = 0;
//			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
//			gridBagConstraints1.gridx = 1;
//			gridBagConstraints1.gridy = 0;
//			_source_file_label = new JLabel();
//			_source_file_label.setText("Quelldatei");
//			GridBagConstraints gridBagConstraints = new GridBagConstraints();
//			gridBagConstraints.gridx = 0;
//			gridBagConstraints.gridy = 0;
//			_table_label = new JLabel();
//			_table_label.setText("Tabelle");
//			_content_panel=new JPanel();
//			_content_panel.setLayout(new GridBagLayout());
//			_content_panel.add(_table_label, gridBagConstraints);
//			_content_panel.add(_source_file_label, gridBagConstraints1);
//			_content_panel.add(get_table_combo_box(), gridBagConstraints11);
//			_content_panel.add(get_source_file_text_field(), gridBagConstraints3);
//			_content_panel.add(get_source_file_chooser_button(), gridBagConstraints4);
//			_content_panel.add(_database_label, gridBagConstraints5);
//			_content_panel.add(_destination_folder_label, gridBagConstraints6);
//			_content_panel.add(get_database_combo_box(), gridBagConstraints7);
//			_content_panel.add(get_destination_folder_text_field(), gridBagConstraints8);
//			_content_panel.add(get_destination_folder_chooser_button(), gridBagConstraints9);
//			_content_panel.add(get_generate_button(), gridBagConstraints10);
//			_content_panel.add(get_messages_pane(), gridBagConstraints111);
			GridBagConstraints gridBagConstraints111 = new GridBagConstraints();
			gridBagConstraints111.fill = GridBagConstraints.BOTH;
			gridBagConstraints111.gridy = 5;
			gridBagConstraints111.weightx = 1.0;
			gridBagConstraints111.weighty = 1.0;
			gridBagConstraints111.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints111.gridwidth = 3;
			gridBagConstraints111.gridx = 0;
			GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
			gridBagConstraints10.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints10.weightx = 1.0;
			gridBagConstraints10.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints10.gridx = 0;
			gridBagConstraints10.gridwidth = 3;
			gridBagConstraints10.gridy = 4;
			GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
			gridBagConstraints9.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints9.weightx = 1.0;
			gridBagConstraints9.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints9.gridx = 2;
			gridBagConstraints9.gridy = 3;
			GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
			gridBagConstraints8.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints8.weightx = 1.0;
			gridBagConstraints8.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints8.gridy = 3;
			gridBagConstraints8.gridx = 1;
			GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
			gridBagConstraints7.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints7.weightx = 1.0;
			gridBagConstraints7.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints7.gridy = 3;
			gridBagConstraints7.gridx = 0;
			GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
			gridBagConstraints6.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints6.weightx = 1.0;
			gridBagConstraints6.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints6.gridx = 1;
			gridBagConstraints6.gridy = 2;
			_destination_folder_label = new JLabel();
			_destination_folder_label.setText("Zielverzeichnis:");
			GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
			gridBagConstraints5.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints5.weightx = 1.0;
			gridBagConstraints5.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints5.gridx = 0;
			gridBagConstraints5.gridy = 2;
			_database_label = new JLabel();
			_database_label.setText("Datenbank:");
			GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
			gridBagConstraints4.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints4.weightx = 1.0;
			gridBagConstraints4.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints4.gridx = 2;
			gridBagConstraints4.gridy = 2;
			GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
			gridBagConstraints3.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints3.weightx = 1.0;
			gridBagConstraints3.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints3.gridy = 1;
			gridBagConstraints3.gridx = 1;
			GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
			gridBagConstraints11.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints11.weightx = 1.0;
			gridBagConstraints11.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints11.gridy = 1;
			gridBagConstraints11.gridx = 0;
			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
			gridBagConstraints1.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints1.weightx = 1.0;
			gridBagConstraints1.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints1.gridx = 1;
			gridBagConstraints1.gridy = 0;
			_source_file_label = new JLabel();
			_source_file_label.setText("Quelldatei:");
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			gridBagConstraints.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints3.weightx = 1.0;
			gridBagConstraints.insets = new Insets(4, 4, 4, 4);
			gridBagConstraints.gridx = 0;
			gridBagConstraints.gridy = 0;
			_table_label = new JLabel();
			_table_label.setText("Tabelle:");
			_content_panel=new JPanel();

			gridBagConstraints.anchor = GridBagConstraints.EAST;
			gridBagConstraints11.anchor = GridBagConstraints.EAST;
			gridBagConstraints5.anchor = GridBagConstraints.EAST;
			gridBagConstraints7.anchor = GridBagConstraints.EAST;
			_content_panel.setLayout(new GridBagLayout());
			_content_panel.add(_table_label, gridBagConstraints);
			_content_panel.add(_database_label, gridBagConstraints11);//gridBagConstraints5);
			_content_panel.add(_source_file_label, gridBagConstraints5);//gridBagConstraints1);
			_content_panel.add(_destination_folder_label, gridBagConstraints7 );

			gridBagConstraints1.anchor = GridBagConstraints.WEST;
			gridBagConstraints3.anchor = GridBagConstraints.WEST;
			gridBagConstraints6.anchor = GridBagConstraints.WEST;
			gridBagConstraints8.anchor = GridBagConstraints.WEST;
			_content_panel.add(get_table_combo_box(), gridBagConstraints1);//gridBagConstraints11);
			_content_panel.add(get_database_combo_box(), gridBagConstraints3);//gridBagConstraints7);

			_content_panel.add(get_source_file_text_field(), gridBagConstraints6 );//gridBagConstraints3);
			_content_panel.add(get_source_file_chooser_button(), gridBagConstraints4);

			_content_panel.add(get_destination_folder_text_field(), gridBagConstraints8);
			_content_panel.add(get_destination_folder_chooser_button(), gridBagConstraints9);

			_content_panel.add(get_generate_button(), gridBagConstraints10);
			_content_panel.add(get_messages_pane(), gridBagConstraints111);
		}
		return _content_panel;
	}

	/**
	 * This method initializes _table_combo_box
	 *
	 * @return javax.swing.JComboBox
	 */
	JComboBox get_table_combo_box() {
		if (_table_combo_box==null) {
			_table_combo_box=new JComboBox();
		}
		return _table_combo_box;
	}

	/**
	 * This method initializes _source_file_text_field
	 *
	 * @return javax.swing.JTextField
	 */
	JTextField get_source_file_text_field() {
		if (_source_file_text_field==null) {
			_source_file_text_field=new JTextField();
			_source_file_text_field.setColumns(30);
		}
		return _source_file_text_field;
	}

	/**
	 * This method initializes _source_file_chooser_button
	 *
	 * @return javax.swing.JButton
	 */
	JButton get_source_file_chooser_button() {
		if (_source_file_chooser_button==null) {
			_source_file_chooser_button=new JButton();
			_source_file_chooser_button.setText("...");
			_source_file_chooser_button.setMnemonic(KeyEvent.VK_UNDEFINED);
		}
		return _source_file_chooser_button;
	}

	/**
	 * This method initializes _database_combo_box
	 *
	 * @return javax.swing.JComboBox
	 */
	JComboBox get_database_combo_box() {
		if (_database_combo_box==null) {
			_database_combo_box=new JComboBox();
		}
		return _database_combo_box;
	}

	/**
	 * This method initializes _destination_folder_text_field
	 *
	 * @return javax.swing.JTextField
	 */
	JTextField get_destination_folder_text_field() {
		if (_destination_folder_text_field==null) {
			_destination_folder_text_field=new JTextField();
			_destination_folder_text_field.setColumns(30);
		}
		return _destination_folder_text_field;
	}

	/**
	 * This method initializes _destination_folder_chooser_button
	 *
	 * @return javax.swing.JButton
	 */
	JButton get_destination_folder_chooser_button() {
		if (_destination_folder_chooser_button==null) {
			_destination_folder_chooser_button=new JButton();
			_destination_folder_chooser_button.setText("...");
		}
		return _destination_folder_chooser_button;
	}

	/**
	 * This method initializes _generate_button
	 *
	 * @return javax.swing.JButton
	 */
	JButton get_generate_button() {
		if (_generate_button==null) {
			_generate_button=new JButton();
			_generate_button.setText("Generieren");
		}
		return _generate_button;
	}

	/**
	 * This method initializes _messages_pane
	 *
	 * @return javax.swing.JTextPane
	 */
	JTextPane get_messages_pane() {
		if (_messages_pane==null) {
			_messages_pane=new JTextPane();
			_messages_pane.setEditable(false);
			_messages_pane.setPreferredSize(new Dimension(200, 150));
		}
		return _messages_pane;
	}



}  //  @jve:decl-index=0:visual-constraint="10,10"
